﻿<UserControl x:Class="MyPoints.UserControls.WptDetail"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:MyPoints.UserControls.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
    <ImageBrush x:Key="iconPen" ImageSource="..\Imgs\Icons\pen.png" />
    <ImageBrush x:Key="emptyImage" ImageSource="..\Imgs\emptyGallery.png" />
    <local:LatLonConverter x:Key="LatLonConverter" />
    <local:ImageStringToImageConverter x:Key="ImageConverter" />
  </UserControl.Resources>
  <Grid Margin="10" Width="300">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Label Grid.Row="0" Grid.Column="0"  Content="Name:" />
    <TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Name="txtName" Text="{Binding Title, UpdateSourceTrigger=PropertyChanged, Delay=500}" />
    <TextBox x:Name="txtGps" Grid.Row="1" Grid.Column="1" IsReadOnly="True" >
      <TextBox.Text>
        <MultiBinding Converter="{StaticResource LatLonConverter}">
          <Binding Path="lat"/>
          <Binding Path="lon"/>
        </MultiBinding>
      </TextBox.Text>
    </TextBox>
    <ComboBox x:Name="cmbUpdateGpsBy" Grid.Row="1" Grid.Column="2" SelectionChanged="cmbUpdateGpsBy_SelectionChanged">
      <ComboBoxItem Content="... from clipboard" />
      <ComboBoxItem Content="... from text" />
    </ComboBox>
    <Label Grid.Row="2" Grid.Column="0"  Content="Type:" />
    <ComboBox Grid.Row="2" Grid.Column="1" 
              Name="cmbType" SelectionChanged="cmbType_SelectionChanged" />
    <TextBox Grid.Row="2" Grid.Column="1"
             Name="txtType" Text="{Binding Category, UpdateSourceTrigger=PropertyChanged, Delay=500}" Visibility="Hidden" />
    <Button Grid.Row="2" Grid.Column="2"
            Name="btnTypeEditSwitch" Background="{StaticResource iconPen}" ToolTip="Combo/Text type edit mode" Width="16" Height="16" Click="btnTypeEditSwitch_Click" />
    <Label Grid.Row="3" Grid.Column="0"  Content="Desc:" />
    <TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Name="txtDesc" Text="{Binding desc, UpdateSourceTrigger=PropertyChanged, Delay=500}" />
    <Label Grid.Row="4" Grid.Column="0"  Content="Comment:" />
    <TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Name="txtComment" Height="48"
             Text="{Binding cmt, UpdateSourceTrigger=PropertyChanged, Delay=500}" />
    <Grid Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" >
      <Image Source="{Binding img, Converter={StaticResource ImageConverter}}" Stretch="Uniform" x:Name="imgImage">
        <Image.ContextMenu>
          <ContextMenu>
            <MenuItem Header="Edit" Name="mnuEdit" Click="mnuEdit_Click"/>
          </ContextMenu>
        </Image.ContextMenu>
      </Image>
    </Grid>
    
  </Grid>
</UserControl>
